package base;

import java.io.Serializable;

import base.exception.ExceptionCode;

public class JsonResult implements Serializable {
	private static final long serialVersionUID = 1L;
	private boolean success = true;
	private int code;
	private String message = "";
	private Object data;
	

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public JsonResult() {
	}

	public JsonResult(String message) {
		this.message = message;
	}
	
	public JsonResult(Object object) {
		this.data = object;
	}

	public JsonResult(String message, Object object) {
		this.message = message;
		this.data = object;
	}

	public JsonResult(String message, boolean isSuccess) {
		this.message = message;
		this.success = isSuccess;
		if(!isSuccess){
			this.code=ExceptionCode.REQUEST_EXCEPTION;
		}
	}

	public boolean isSuccess() {
		return this.success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return this.message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
}